In [1]:
import numpy as np
from astropy.time import Time
import datetime
The contactLocator1.txt
file is produced by dslwp_occulations.script
.
In [2]:
with open('/tmp/ContactLocator1.txt') as f:
lines = f.readlines()
In [3]:
lines_split = [l.split() for l in lines[4:-5]]
time_format = '%d %b %Y %H:%M:%S.%f'
start_times = Time([datetime.datetime.strptime(' '.join(l[0:4]), time_format) for l in lines_split])
end_times = Time([datetime.datetime.strptime(' '.join(l[4:8]), time_format) for l in lines_split])
In [4]:
deltas = start_times[1:]-end_times[:-1]
cutoff = 0.2
idxs = deltas < cutoff
In [5]:
starts = Time(end_times[:-1][idxs], format='iso').value
ends = Time(start_times[1:][idxs], format='iso').value
In [6]:
for a,b in zip(starts, ends):
print(a,'---',b)